home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
comm
/
misc
/
mirrorman_1_10b1.lha
/
MirrorManager-1.10b1
/
rexx
/
Status.mm
< prev
Wrap
Text File
|
1994-06-24
|
2KB
|
72 lines
/*
** $VER: $Id: Status.mm,v 1.3 1994/06/20 01:08:34 tf Exp $
*/
options results
options failat 21
/* initialize globals */
logfile = "T:MirrorManagerStatus." || pragma('Id')
tempfile = "T:MirrorManagerStatusTemp." || pragma('Id')
patstr = "Warning"
ESC = '1b'x
/**/
WORKING '"Saving..."'
SAVELOG '"'logfile'"'
WORKING '"Extracting important lines ..."'
address command 'Search QUICK FROM "'logfile'" PATTERN "'patstr'" NONUM > "'tempfile'"'
MESSAGE CLEAR; MESSAGE OPEN
WORKING '"Loading ..."'
if loadlog(tempfile) = 0 then do
REQUESTCHOICE TITLE '"Status Request"',
BODY '"failed to open my temporaty file*n*n' ||,
ESC'c'ESC'b' || tempfile || ESC'n'ESC'l' || '"',
GADGETS '"Hummmm"'
call loadlog(logfile)
end
if exists(logfile) then address command 'Delete QUIET FILE "'logfile'"'
if exists(tempfile) then address command 'Delete QUIET FILE "'tempfile'"'
WORKING '"done."'
exit 0
/*@*/
loadlog: procedure
parse arg fname
numlines= 0
if open('fp',fname,'R') then do
do until eof('fp')
s= readln('fp')
if words(s) > 0 then do
numlines= numlines+1;
MESSAGE transquote(s)
end
end
call close('fp')
end
return numlines
/* translate '"' into '*"' and '*' into '**' */
transquote: procedure
parse arg s
t= s
q= max( lastpos('*',s), lastpos('"',s) )
do while q > 0
t= insert('*',t,q-1,1)
s= left(s,q-1)
q= max( lastpos('*',s), lastpos('"',s) )
end
return '"' || t || '"'